package com.fun.feifun.modules.sys.parameter.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fun.feifun.modules.sys.parameter.model.SysParameter;
import com.fun.feifun.modules.sys.parameter.dao.SysParameterMapper;
import com.fun.feifun.modules.sys.parameter.service.ISysParameterService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 系统参数 服务实现类
 * </p>
 *
 * @author wkf
 * @since 2024-06-19
 */
@Service
public class SysParameterServiceImpl extends ServiceImpl<SysParameterMapper, SysParameter> implements ISysParameterService {

    public String getParameByCode(String code){
        QueryWrapper<SysParameter> queryWrapper=new QueryWrapper<>();
        queryWrapper.lambda().eq(SysParameter::getCode,code);
        SysParameter one = getOne(queryWrapper);
        if(ObjectUtils.isEmpty(one)){
            return null;
        }else{
            return one.getValue();
        }
    }

}
